package net.betou.common.security.encoder;

import java.util.Random;

/**
 * 用户名和密码随机生成
 * 
 * @author 叶装装
 * 
 */
public class PasswordRandomGenerator implements RandomGenerator{

	private static final String PASSWORD_RANGE = "0123456789";
	private static final Random random = new Random( );

	public String randomNumByRange( int len ) {
		StringBuffer buffer = new StringBuffer( );
		for ( int i = 0; i < len; i++ ){
			String rand = String.valueOf( PASSWORD_RANGE.charAt( random.nextInt( 10 ) ) );
			buffer.append( rand );
		}

		return buffer.toString( );
	}

}
